package com.asa.common.net.factory

import com.google.gson.TypeAdapter
import okhttp3.ResponseBody
import retrofit2.Converter
import java.io.IOException

class DecodeResponseBodyConverter<T>(private val adapter:TypeAdapter<T>?):Converter<ResponseBody,T> {

    @Throws(IOException::class)
    override fun convert(value: ResponseBody): T? {
        //解密字符串
        val temp = String(value.bytes(), charset("utf-8"))
        return adapter!!.fromJson(temp)
    }


}